#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#define MAXFILE 65535
int main(int argc, char **argv)
{
	pid_t pid;
	int i, j = 0;
	pid=fork();
	if(pid<0)
	{
		printf("error in fork\n");
		return -1;
	}
	else
	{ 
		if(pid > 0)
		{
			printf("parent precess exit\n");
			return 0;
		}
	}
	setsid();

	chdir("/");
	umask(0);
	for(i=0;i<MAXFILE;i++)
	{
			close(i);
	}
//===================================
	for(j = 0; j < 500; j++)
	{
		sleep(5);
	}
//===================================
	return 0;
}
